package cn.zhaoyuening.leasecloud.common.service.impl;

import cn.zhaoyuening.leasecloud.common.dao.BaseDao;
import cn.zhaoyuening.leasecloud.common.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.List;

/**
 * Created by zhao on 17-1-10.
 */
public class BaseServiceImpl<T> implements BaseService<T> {
    @Autowired
    private BaseDao<T> dao;


    public BaseDao<T> getDao() {
        return dao;
    }

    @Override
    public void save(T t) {
        dao.save(t);
    }

    @Override
    public void delete(T t) {
        dao.delete(t);
    }

    @Override
    public T findById(Serializable id) {
        return dao.findById(id);
    }

    @Override
    public void addOrEdit(T t) {
        dao.addOrEdit(t);
    }

    @Override
    public List<T> findAll() {
        return dao.findAll();
    }

    @Override
    public List<T> findAll(String condition, Object[] objects) {
        List<T> list = dao.findAll(condition,objects);
        return list;
    }

    @Override
    public List<T> findAll(String condition, Object[] params, int startIndex, int pageSize) {
        List<T> list = dao.findAll(condition, params, startIndex, pageSize);
        return list;
    }

    @Override
    public long getTotalRecord() {
        return dao.getTotalRecord();
    }
}
